Field of the Invention
Embodiments of the present invention relate generally to graphics processing and, more specifically, to adaptive shading in a graphics processing pipeline.
Description of the Related Art
A typical computer system includes a central processing unit (CPU) and a graphics processing unit (GPU). Some GPUs are capable of very high performance using a relatively large number of small, parallel execution threads on dedicated programmable hardware processing units. The specialized design of such GPUs usually allows these GPUs to perform certain tasks, such as rendering 3-D scenes, much faster than a CPU. However, the specialized design of these GPUs also limits the types of tasks that the GPU can perform. By contrast, the CPU is typically a more general-purpose processing unit and therefore can perform most tasks. Consequently, the CPU usually executes the overall structure of a software application and then configures the GPU to implement a graphics processing pipeline that transform 3-D images generated by the software application into rendered 2-D images.
As part of transforming a 3-D image, the image is divided into a two dimensional array of pixels, each representing a different image location. The dimensions of this two dimensional array of pixels defines the resolution of the rendered 2-D image. In general, as part of processing a pixel, a pixel shading subsystem included in the graphics processing pipeline performs a variety of per-pixel shading calculations designed to accurately determine the color of the pixel based on effects such as lighting. However, the viewer's ability to resolve images may exceed the resolution of the rendered 2-D image. Consequently, visual artifacts produced during the rendering may dramatically, and often unacceptably, reduce the realism of the 2-D image. For example, if an edge of a triangle is not aligned with a vertical or horizontal line of pixel locations, the edge will exhibit a jagged, stair-step appearance in the rendered 2-D image.
One approach to improving the realism of rendered images is to increase the resolution of the rendered 2-D image. Increasing the resolution improves the ability of the pixel shading subsystem to accurately portray certain effects at particular portions of rendered images. For example, increasing the resolution may enable the graphics processing pipeline to smooth the appearance of edges. However, portions of many rendered images exhibit relatively uniform visual characteristics, and increasing the resolution does not improve the realism of such portions of rendered images. In addition, certain types of effects (e.g., ambient lighting) are applied relatively uniformly across the image and, consequently, increasing the resolution may cause the pixel shading subsystem to perform redundant pixel shading calculations. Notably, the majority of the execution time required during rendering is spent performing operations, such as texture fetches, associating with the pixel shading calculations. Consequently, increasing the resolution may lead to both an increase in power consumption and a decrease in rendering frame rate that is disproportionate to the improvement in the quality of the rendered image.
Accordingly, what is needed in the art is a more effective approach to improving the realism of rendered images.